<?php
include_once "conn.php";
$goods = [];
$sql = $db -> query("SELECT goods_type_id,goods_type,goods_type_pic 
FROM goods_type ORDER BY RAND() LIMIT 0,4");
while ($row = $sql -> fetch_assoc()) {
    array_push($goods,$row);
}
echo json_encode($goods);
$db->close();
?>